﻿<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="4" MadCap:lastHeight="516" MadCap:lastWidth="970">
    <head>
    </head>
    <body>
        <h1>Semantic Logging</h1>
        <p>Semantic Logging is proposed by the <a href="../../QuickStartGuide.htm#http://msdn.microsoft.com/en-us/library/ff921345.aspx" target="_blank">Microsoft Patterns and Practices Group</a> and an implementation is given in <a href="../../QuickStartGuide.htm#http://msdn.microsoft.com/en-us/library/dn169621.aspx" target="_blank">Enterprise Library 6</a> (April 2013). It addresses the following problems:</p>
        <ul>
            <li>It is difficult to find  information in an unstructured log containing 1000s of entries that are just comments</li>
            <li><a href="MxError-EventTracingForWindows.htm">Event Tracing for Windows</a> is difficult to implement</li>
        </ul>
        <p>Semantic Logging  suffers from the following weaknesses:</p>
        <ul>
            <li>The implementation in the Entrerprise Library is based on .NET EventSource class. There isn't support for C++ etc.</li>
            <li>Programmers are required to create a new method for each log message type. This overhead acts as a disincentive to handle errors</li>
            <li>Log message types may be reused so the error code is not unique to a particular line of code</li>
        </ul>
        <h2>General Approach</h2>
        <p>The Semantic Logging Application Block (SLAB) provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include:</p>
        <ul>
            <li> Windows Azure table storage</li>
            <li>SQL Server databases</li>
            <li>Flat files with several formats and rolling capabilities. </li>
        </ul>
        <p>Developers can extend the block by creating custom formatters and sinks. For those sinks like ETW that can store structured data, the block preserves the full structure of the event payload in order to facilitate analyzing or processing the logged data. Events can be persisted in-process or collected and persisted out-of-process in a separate service.</p>
        <h2>Suggested Implementation</h2>
        <p>&#160;</p>
    </body>
</html>